package org.lightcommons.orm.hibernate;

import java.io.Serializable;

import org.hibernate.SessionFactory;
import org.lightcommons.orm.DefaultDao;

public class HibernateDao<T,ID extends Serializable> extends DefaultDao<T, ID> {

	private final HibernateDaoTemplate	hibernateDaoTemplate;
	
	/**
	 * 
	 */
	public HibernateDao(SessionFactory sessionFactory) {
		this(new ThreadLocalSessionHolder(sessionFactory));
	}
	
	/**
	 * 
	 */
	public HibernateDao(SessionHolder sessionHolder) {
		this(new HibernateDaoTemplate(sessionHolder));
	}
	
	public HibernateDao(HibernateDaoTemplate hibernateDaoTemplate) {
		super(hibernateDaoTemplate);
		this.hibernateDaoTemplate = hibernateDaoTemplate;
	}

	protected HibernateDao(HibernateDaoTemplate hibernateDaoTemplate,Class<T> entityClass,Class<ID> idClass) {
		super(hibernateDaoTemplate,entityClass,idClass);
		this.hibernateDaoTemplate=hibernateDaoTemplate;
	}
	
	public HibernateDaoTemplate getHibernateDaoTemplate() {
		return hibernateDaoTemplate;
	}

}
